font chooser: Make Escape stop search
authorMatthias Clasen <mclasen@redhat.com>
Mon, 10 Aug 2015 18:15:26 +0000 (20:15 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 11 Aug 2015 02:43:18 +0000 (22:43 -0400)
gtk/gtkfontchooserwidget.c
gtk/ui/gtkfontchooserwidget.ui

index a0db55c753737426c95710bdbe5132337e3e60e4..6f1701f80c0941fe25230a84d3480075d51397b3 100644 (file)
@@ -301,12 +301,18 @@ gtk_font_chooser_widget_refilter_font_list (GtkFontChooserWidget *fontchooser)
 
 static void
 text_changed_cb (GtkEntry             *entry,
-                 GParamSpec           *pspec,
                  GtkFontChooserWidget *fc)
 {
   gtk_font_chooser_widget_refilter_font_list (fc);
 }
 
+static void
+stop_search_cb (GtkEntry             *entry,
+                GtkFontChooserWidget *fc)
+{
+  gtk_entry_set_text (entry, "");
+}
+
 static void
 size_change_cb (GtkAdjustment *adjustment,
                 gpointer       user_data)
@@ -580,6 +586,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, size_slider);
 
   gtk_widget_class_bind_template_callback (widget_class, text_changed_cb);
+  gtk_widget_class_bind_template_callback (widget_class, stop_search_cb);
   gtk_widget_class_bind_template_callback (widget_class, cursor_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, gtk_font_chooser_widget_set_cell_size);
index 98b6b0edb1a6e4b3ecef28f6bfe137a3a6640ede..be0446180bdaacd7506f7feaa76a1f679f497282 100644 (file)
@@ -48,7 +48,8 @@
             <property name="primary_icon_sensitive">False</property>
             <property name="secondary_icon_sensitive">False</property>
             <property name="placeholder_text" translatable="yes">Search font name</property>
-            <signal name="notify::text" handler="text_changed_cb" swapped="no"/>
+            <signal name="search-changed" handler="text_changed_cb" swapped="no"/>
+            <signal name="stop-search" handler="stop_search_cb" swapped="no"/>
           </object>
           <packing>
             <property name="left_attach">0</property>